{extend name="./application/admin/view/public/base.html" /}
{block name="style"}<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" /> {/block}
{block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li>
			<a href="{:url('index')}">自动回复</a>
		</li>
		<li><strong>添加关键词</strong></li>
	</ol>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-content">
				<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('add')}">
					<div class="form-group">
						<label class="col-sm-3 control-label">关键词：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="key" name="key" placeholder="关键词" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">回复类型：</label>
						<div class="input-group col-sm-4">
							<select id="we_reply_type" name="type" class="form-control">
								<option value="text">文字回复</option>
								<option value="image">图片回复</option>
								<option value="news">图文回复</option>
							</select>
						</div>
					</div>
					<div id="input-text">
						<div class="hr-line-dashed"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">回复内容：</label>
							<div class="input-group col-sm-4">
								<input type="text" id="content" name="content" placeholder="回复内容" class="form-control" />
							</div>
						</div>
					</div>
					<div id="input-image">
						<div class="hr-line-dashed"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">封面图片：</label>
							<div class="input-group col-sm-3">
								<input type="hidden" id="thumb" name="thumb"/>
								<input id="upload" name="upload" type="file" />
							</div>													
						</div>
				   </div>	
					<div id="input-news">
						<div class="hr-line-dashed"></div>
						<div class="form-group">
							<label class="col-sm-3 control-label">图文：</label>
							<div class="input-group col-sm-4">
								<input type="text" id="news_id" name="news_id" placeholder="图文" class="form-control" />
							</div>
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-3">							
							<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
							<a href="{:url('index')}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block} {block name="script"}
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script>
	
	upload_one('__IMG__/default.jpg');
	$("#myForm").submit(function() {
		ajaxForm();
		return false;
	}
	);
	$("#input-news").hide();
	$("#input-image").hide();
	$('#we_reply_type').change(function() {
		var $type = $(this).val();
		if($type == 'news') {
			$("#input-text").show();
			$("#input-image").show();
		} else if($type == 'image') {
			$("#input-text").hide();
			$("#input-image").show();
		} else if($type == 'text') {
			$("#input-text").show();
			$("#input-image").hide();
		}
	});
</script>
{/block}